﻿/*******Start pui********/
(function($){
var Pui = window.Pui = {
	
	
	
//载入滚动公告
loadPublicNews:function(newslist){
	var publicNewsList="";
	var publicNewshref="";
	for(var i=0;i<newslist.length;i++){
		publicNewshref+="<li>"+newslist[i][0]+"</li>";
	}
	publicNewsList="<ul id='publicNewsList'>"+publicNewshref+"</ul>";
	$('#publicNews').html(publicNewsList);
},


	// 初始化
	init: function() {
		baseurl = 'http://www.pomoho.com/do/';
		_user = { uid:0, nick:'', spacename:'', newmsg:0 };
		_is_login = false;
		var n = this.cookie('LoginInfo');
		if (n) {
			var arr = n.split('$***$');
			_user = { uid:arr[0].replace('LoginInfo=', ''), nick:arr[1],spacename:arr[2], newmsg:0 };
			_is_login = true;
			}
	},
	initManage: function(id) {
		if(typeof(id) != 'undefined' && _user.uid != parseInt(id)) {$(".mDocument .is_login").hide();}
	},
	// cookie操作
	cookie: function(name, value, options) {
		if (typeof(value) != 'undefined') {
			options = options || {};
			if (value === null) {
				value = '';
				options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
				var date;
				if (typeof options.expires == 'number') {
					date = new Date();
					date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
				} else {
					date = options.expires;
				}
				expires = '; expires=' + date.toUTCString();
			}
			var path = options.path ? '; path=' + options.path : '';
			var domain = options.domain ? '; domain=' + options.domain : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', escape(value), expires, path, domain, secure].join('');
		} else {
			var cookieValue = null;
			if (document.cookie && document.cookie != '') {
				var cookies = document.cookie.split(';');
				for (var i = 0; i < cookies.length; i++) {
					var cookie = jQuery.trim(cookies[i]);
					if (cookie.substring(0, name.length + 1) == (name + '=')) {
						cookieValue = unescape(cookie.substring(name.length + 1));
						break;
					}
				}
			}
			return cookieValue;
		}
	},

	// 载入外部Script，解决跨域ajax调用问题
	loadScript: function(url, options) {
		var setting = {
			random: true
		};
		if(options) {
			$.extend(setting, options);
		}
		var f = document.createElement('script');
		f.type = 'text/javascript';
		var d = new Date();
		if(setting.random) {
			if(url.match(/.*\?.*/)) {
				url = url + '&random=' + d.getTime() + parseInt(Math.random()*10000);
			} else {
				url = url + '?random=' + d.getTime() + parseInt(Math.random()*10000);
			}
		}
		f.src = url;
		$('head')[0].appendChild(f);
	},

	// 消息回显(ajax)
	callback: function(msg) {
		alert(msg);
	},
	user:{
		addContent:function (){
				if(!$("#sendMsg").length){
					$('#Prompt h3').after('<p id="sendMsg" class="p1"></p>');
					$('#btnlog').after('<input class="back" type="button" value="返回当前页面" /><input class="space" type="button" value="去我的个人空间" />');
					$("#Prompt .back").bind("click",Pui.newSH.closeDiv);
					$("#Prompt .space").click(function (){
						window.open('http://home.pomoho.com/'+_user.spaceurl+'.shtml');
						
					});
					
				}
			},showPromptDiv:function (flvid,flvtitle){
				if($("#Prompt").length==0)
					Pui.newSH.showLogDiv();
				flv={
					ids:flvid,title:flvtitle
				};
				this.addContent();
				if(_is_login){
					Pui.user.haveFriend();
					
				}else {
					flag=1;
					Pui.newSH.loginfo();
					
				}
			},haveFriend:function (){
				$.ajax({
					url:"http://"+window.location.hostname+"/sendajaxreq.aspx",dataType:"xmlDocument",type:"POST",data:"action=http://www.pomoho.com/do/interfaces/sendtofriends.aspx&imdbid="+flv.ids+"&type=sendfriends&userid="+_user.uid+"&random="+Math.random(),error:function (){
						alert('读取文件错误');
						Pui.newSH.closeDiv();
						
					},success:function (result){
						var userlog=eval(result);
						switch(parseInt(userlog[0].stat)){
							case 0:Pui.user.sendNoFriend();
							break;
							case 1:Pui.user.sendSuccess();
							break;
							default:Pui.user.sendErr(userlog[1].ErrMsg);
							break;
							
						};
						
					}
				});
				
			},sendSuccess:function (){
				$("#Prompt .k")[0].className="k suc";
				$("#Prompt").show();
				var gameUrl="http://video.pomoho.com/ent/"+flv.ids;
				$("#sendMsg").html("视频&#8220;<a href="+gameUrl+" ><u>"+flv.title+"</u></a>&#8221;已成功推荐给您的米花好友,他们将在下次登录的时候,收到您的推荐信息.");
				flv=null;
				
			},sendNoFriend:function (){
				$("#Prompt .k")[0].className="k err";
				$("#Prompt").show();
				$("#sendMsg").html("非常抱歉。您在爆米花还没有好友，这个好像不对哦:),人在江湖走，哪能没朋友呢，赶紧邀请你的好友加入爆米花吧.");
				flv=null;
				
			},sendErr:function (errcode){
				$("#Prompt .k")[0].className="k err";
				$("#Prompt").show();
				$("#sendMsg").html("可能网络问题,推荐失败,请重试.错误代码:"+errcode);
				flv=null;
				
			}
	},
	pos: {
		// 计算元素相对于页面顶端的距离
		elementTop: function(element) {
			var y = 0;
			for(var e = element; e; e = e.offsetParent) 
				y += e.offsetTop;

			for(e = element.parentNode; e && e != document.body; e = e.parentNode)
				if (e.scrollTop) y -= e.scrollTop;
			return y;
		}
	},
	// 涉及界面上用户操作的部分
	ui: function() {
		return {
			bookmark:function (title,url){
				if($.browser.msie){
					window.external.AddFavorite(url,title);
				}else if($.browser.mozilla){
					window.sidebar.addPanel(title,url,'');
				}
			},
			setHome:function(url){
		        try{
	                document.body.style.behavior='url(#default#homepage)';
	                document.body.setHomePage(url);
		        }
		        catch(e){
	                if(window.netscape) {
                        try{
                            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
							var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
							prefs.setCharPref('browser.startup.homepage','http://www.pomoho.com');
                        }
                        catch(e) { 
                            alert("不好意思，此操作被浏览器拒绝……\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'\n或者直接在选项中设置首页。多谢支持爆米花的产品。");
                        }
	                 }
		        }
			},
			copy: function(text, msg) {
				if ($.browser.msie) {
					window.clipboardData.setData("Text", text);
				} else {
					if (!document.getElementById('flashcopier')) {
						$('<div id="flashcopier"></div>').appendTo('body');
					}
					$('#flashcopier').html('<embed src="http://static.pomoho.com/scriptures/clipboard.swf" FlashVars="clipboard='+text+'" width="0" height="0" style="position:absolute; top:-2000px;" type="application/x-shockwave-flash"></embed>');
				}
				if (msg) {
					alert(msg);
				}
			},
			// 获取时间
			gettime: function() {
				var time = new Date();
				var t_year = ($.browser.msie) ? time.getYear() : String(time).split(" ")[3];
				var t_time = ($.browser.msie) ? String(time).split(" ")[3].substr(0,5) : String(time).split(" ")[4].substr(0,5);
				var f_time = t_year + "-" + parseInt(time.getMonth()+1) + "-" + time.getDate() + " " + t_time;
				return f_time;
			},
			setServerTime: function(time) {
				_servertime = time;
			},
			loadServerTime: function() {
				Pui.loadScript("http://www.pomoho.com/do/time/echo_second.aspx");
			}
		};
	}()
};

Pui.init();

Pui.showData = function(json) {
	
	if(json[0].type=="video"&&json[0].data[1]!=0)
	{
		Pui.loadScript('http://video.pomoho.com/getvideobaseinfo.aspx?itype=3&flvid='+flvid);//Ajax 读取评论
	}else if(json[0].type=="video"&&json[0].data[1]==0){
		$("#CommentTemp").remove();
	}
	var path = {
		user: ['.t_login span', '.c_friend span', '.c_fans span', '.c_view span', '.c_video span', '.c_flower span','.c_count span','.c_club span','.c_subject span'],
		video: ['.c_view span', '.c_review span', '.c_bookmark span'],
		special: ['.c_video span', '.c_view span', '.c_rss span', '.t_update span', '.t_length span']
	};

	// path for new xhtml/css mod
	var path_n = {
		user: ['.d_time_login span', '.d_friend span', '.d_fans span', '.d_view span', '.d_video span', '.d_flower span'],
		video: ['.d_view span', '.d_review span', '.d_bookmark span'],
		special: ['.d_video span', '.d_view span', '.d_rss span', '.d_update span', '.d_length span']
	};

	for(var i=0,length=json.length; i<length; i++) {
		var type = json[i].type,
			id = json[i].id,
			data = json[i].data,
			wrap = '#'+type+'_'+id;
		
		if(!$(wrap)[0]) continue;

		for(j=0; j<path[type].length; j++) {
			if($(wrap+' '+path[type][j])[0]) {
				$(wrap+' '+path[type][j])[0].innerHTML = data[j];
			} else if ($(wrap+' '+path_n[type][j])[0]) {
				$(wrap+' '+path_n[type][j])[0].innerHTML = data[j];
			}
		}
	}
};

/************************** jQuery plugins **********************************/
$.fn.toggleShow = function(options) {
	var o = {el:'.mUser', cls:'current'};
	if (options) $.extend(o, options);
	
	return $(this).each(function(){
		$(this).find(o.el).mouseover(function(){
			if ($(this).attr('class').indexOf(o.cls) != -1) return;
			$(this).parent().find('.'+o.cls).removeClass(o.cls);
			$(this).addClass(o.cls);
		});
	});
};

})(jQuery);

/********************video.js by sorrycc at 2007-10-22**********************/
Pui.video = {
	init: function() {
		this.dataConsist(); //数据一致性等接口
		this.zz(); //转载
		this.emotionWR(); //评论表情写入
		this.emotion(); //评论表情翻页事件
		this.commentReply(); //即时回复
		$('#post_content').bind('focus',function(){CodeImgLoader()});//评论显示
		this.quickComment();
	},
	dataConsist: function() {
		Pui.loadScript("http://live.pomoho.com/getxmldata.aspx?type=1&ids=" + userid);
		Pui.loadScript('http://live.pomoho.com/getxmldata.aspx?type=2&ids=' + flvid + '_999');
		
	},
	commentLoader: function(e){ //Ajax 读取评论回调
		$('#CommentTemp').remove();
		$('#Comment .title').after(e);
		$("#Comment h3 span").text("20");//更改评论总数量(临时)
		Pui.initManage(userid);
		$('.commentQuote').prepend('<div>引用：</div>');
	},
	hideIntro: function() {
		var str = $('#Layout_1 .vp .v_intro').text();
	},
	zz: function() {
		var urlH = "";
		var urlParm = "";
		var swf = "";
		var isMv = location.href.indexOf("/mv/") > -1 ? true : false;
		if(isMv)
		{
			urlH = "mv";
			urlParm = "mvid";
			swf = "mv_out_player.swf";
		}
		else
		{
			urlH = "ent";
			urlParm = "flvid";
			swf = "out_player.swf";
		}
		
		var htmlcode = '';
		var vTitle=encodeURIComponent($('title').html().replace(/(^\s*)|(\s*$)/g, ""));
		var vLink=encodeURIComponent('http://video.pomoho.com/ent/'+flvid+'.shtml');
		var vContent=encodeURIComponent('http://video.pomoho.com/swf/out_player.swf?flvid='+flvid);
		var s = '';
		s += '<div id="ZZ" style="display:none;">';
		s += '	<div class="s1">';
		s+='站外引用：<br />';
		s+='<span class="icos"><a id="renren" href="http://share.renren.com/share/buttonshare.do?link='+vLink+'&title='+vTitle+'" target="_blank" title="转贴至人人网">转贴至人人网</a><a id="kaixin" href="http://www.kaixin001.com/repaste/share.php?rurl='+vLink+'&rcontent='+vLink+'&rtitle='+vTitle+'" target="_blank" title="转贴至开心网">转贴至开心网</a><a id="sina" href="http://v.t.sina.com.cn/share/share.php?url='+vLink+'&title='+vTitle+'" target="_blank" title="转贴至新浪围脖">转贴至新浪围脖</a><a id="itieba" href="http://tieba.baidu.com/i/sys/share?link=' + vLink+'&type=video&title=' + vTitle+'&content=' + vContent+'" target="_blank" title="转贴至i贴吧">转贴至i贴吧</a></span>';
		htmlcode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="594" height="405" id="object"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="http://video.pomoho.com/swf/'+swf+'?'+urlParm+'='+flvid+'" /><embed src="http://video.pomoho.com/swf/'+swf+'?'+urlParm+'='+flvid+'" quality="high" width="594" height="405" allowScriptAccess="always"/></object>';
		s += '		此节目地址（URL）<br /><input type="text" class="url" value="http://video.pomoho.com/'+urlH+'/'+flvid+'" /><br />';
		s += '		把播放器显示到个人空间或Blog<br /><input type="text" class="url" value="http://video.pomoho.com/swf/'+swf+'?'+urlParm+'='+flvid+'" /><br />';
		s += '		HTML代码,适用于个人空间（或其他类型的Blog）<br /><input type="text" class="url" value="" /><br />';
		s += '		BBS代码<br /><input type="text" class="url" value="[flash]http://video.pomoho.com/swf/'+swf+'?'+urlParm+'='+flvid+'[/flash]" />';
		s += '	</div>';
		s += '	<div class="s2">';
		s += '	</div>';
		s += '  <p><a href="" onclick="$(\'#ZZ\').slideUp();return false;">关闭</a></p>';
		s += '</div>';
		var vPath = '#Layout_1 .vp .handle';
		$(vPath).after(s).find('.s4').click(function(){
			$('#ZZ').slideToggle();
			this.blur();
			return false;
		});

		$('#ZZ .url').eq(2).attr('value', htmlcode).end().hover(function(){
			$(this).select();
		}, function(){
			$(this).blur();	
		});
		
	},
	hideComment: function(num) {
		if (String(window.location).match(/http:\/\/home.*/)) {
			$('#Comment .mDocument').filter(':gt(19)').hide();
		} else {
			$('#Comment .mDocument').filter(':gt(19)').hide();
		}
		$('#Comment h3 span').html(20);
	},
	emotion: function() {
		var emotionID = 1;
		var emFlag = 2;
		$('#Comment .emotion').find('.l').click(function() {
			if (emotionID >= 2) {
				$('#emotionBox').animate({left: -(500*(emotionID-2))}, 1000);
				if (emotionID == 2) {
					$('#Comment .l').removeClass('l_b').attr('title', '左边没有了');
				} else if (emotionID == 4) {
					$('#Comment .r').addClass('r_b').attr('title', '向右翻');
				}
				emotionID --;
			}
			this.blur();
			return false;
		}).end().find('.r').click(function() {
			if (emotionID <= 3) {
				$('#emotionBox').animate({left: -(500*emotionID)}, 1000);
				if (emotionID == 1) {
					$('#Comment .l').addClass('l_b').attr('title', '向左翻');
				} else if (emotionID == 3) {
					$('#Comment .r').removeClass('r_b').attr('title', '右边没有了');
				}
				emotionID ++;
				if(emFlag == emotionID){ //动态添加表情图标
					s = Pui.video.emotionAdd(emotionID);
					$('#emotionBox').append(s);
					emFlag ++;
				}
			}
			this.blur();
			return false;
		});
		//+zhuxf 2008-3-4 添加验证码代码+
		SetValidCodeImg();
	},
	emVal: function(e){
		var tmp = $('#Comment textarea').val() + '[em'+e+']';
		$('#Comment textarea').val(tmp);
	},
	emotionWR: function() {
		var s = '';
		s += '<div style="position:relative;width:500px;height:60px;overflow:hidden;margin:0 auto;"><div id="emotionBox" style="position:absolute;left:0;top:0;width:100000px;">';
		s += Pui.video.emotionAdd(1);
		s += '</div></div>';
		s += '<a href="" class="l" title="左边没有了">向左翻</a><a href="" class="r r_b" title="向右翻">向右翻</a>';
		$('#Comment .commentAdd .emotion').html(s);
	},
	emotionAdd: function(e) { //动态添加表情图标
		var s = '';
		var l = 'http://static.pomoho.com/images/em/';
		//var l = 'images/';
		var alt = ['Kiss','口水','汗','开心','流鼻血','3Q','有爱','哈','被雷到了','好热','很惨','很冷','很萌啊','火星','闭嘴','囧','泪奔','不屑','萌','萌状','怒','呸','索吻','吐','无语','吓到','邪恶','大跌眼镜','疑问','得意','找死','难过'];		
		s += '<div style="width:500px;float:left;text-align:center;">';
		for(var j=(e-1)*8+1; j<=e*8; j++) {
			s += '<a href="javascript:Pui.video.emVal('+j+');" title="'+alt[j-1]+'"><img src="'+l+'em'+j+'.gif" height="50" /></a>';
		}
		s += '</div>';
		return s;
	},
	quickComment:function(){
		
		$("#Handle .h_comment").click(function(){
			if($("#QuickComment").length>0){
				$(".f_v").show();
				$("#QuickComment").show();
				$("#Quicktextarea").focus();
				return
			}
			var str='';
			str+='<div class="f_v"></div>'
			str+='<div class="f_comment" id="QuickComment">';
			str+='<input type="text" value="" class="iText01" id="Quicktextarea"/>';
			str+='<input type="text" value="" class="iText02" id="QvalidText"/>';
			str+='<a title="看不清楚？请点击刷新验证码" href="javascript:GetValidCodeImg();"><img src="" id="validImg" class="valid"/></a>';
			str+='<a href="javascript:void(0)" class="iBtn01">提交</a>';
			str+='<a href="javascript:void(0)" class="iBtn02">取消</a><input type="submit" style="display:none" onsubmit="return false" />';
			str+='</div>';
			$("#Handle").after(str);
			$("#Quicktextarea").focus();
			setTimeout(GetValidCodeImg,100)
			$("#QuickComment .iBtn02").click(function(){
				$("#Quicktextarea").val("");
				$("#QvalidText").val("");
				$(".f_v").hide();
				$("#QuickComment").hide();	
			});
			
			$("#QvalidText").keyup(function(e){
				var event = window.event || e;
				if (event.keyCode == 13) {
					$(this).blur()
					$("#QuickComment .iBtn01").click();
				}
			});	
			$("#tb_validcode").keyup(function(e){
				var event = window.event || e;
				if (event.keyCode == 13) {
					$(this).blur()
					$('#Comment input[@type=submit]').click();
				}
			});	
			$('#QuickComment .iBtn01').click(function(){	
	
				textarea=window.textarea = $('#Quicktextarea');
				if ($.trim(textarea.val()) == ''){
					alert('评论内容不可为空！');
					$("#Quicktextarea").focus();
					return;
				}
				
				var QValidCode = "";
				if(document.getElementById("QvalidText") != null){
					QValidCode = document.getElementById("QvalidText").value;
					if ($.trim(QValidCode) == ''){
						alert('验证码不可为空！');
						if($.browser.msie)
							$('#QvalidText').focus();
						return;
					}
				}
				var scontent = textarea.val().replace("<", "&lt;").replace(">", "&gt;").replace("&", "<--@@-@@-->").replace("\n", " ");
				scontent = escape(scontent);
				if ($('body').attr('id') == 'SpaceAlbum_Detail') {
					Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=6&imdbid=" + imgid + "&content=" + scontent + "&validcode=" + QValidCode, {random:true});
				} else {
					Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=1&imdbid=" + flvid + "&content=" + scontent + "&validcode=" + QValidCode, {random:true});
				}
				var ct = Pui.pos.elementTop(document.getElementById('Comment'));
				//window.scrollTo(0, ct-30);
				//$('#Comment .cl, #Comment .cc').fadeTo('slow', 0.3);
				this.blur();
				flag_comment=1;
				$(".f_v").hide();
				$("#QuickComment").hide();
				setTimeout("Pui.video.commentReplyFill()", 1000);
				//$("#Quicktextarea").val("");
				$('#QvalidText').val("");
				setTimeout(GetValidCodeImg,100)
				
			});
			
		
			});
		
	},
	commentReply: function() {
		$('#Comment input[@type=submit]').click(function(){	
			
			textarea = $('#Comment textarea');
			if ($.trim(textarea.val()) == ''){
				alert('评论内容不可为空！');
				textarea.focus();
				return;
			}
			var sValidCode = "";
			if(document.getElementById("tb_validcode") != null){
				sValidCode = document.getElementById("tb_validcode").value;
				if ($.trim(sValidCode) == ''){
					alert('验证码不可为空！');
					$('#tb_validcode').focus();
					return;
				}
			}
			flag_comment=2;
			var scontent = textarea.val().replace("<", "&lt;").replace(">", "&gt;").replace("&", "<--@@-@@-->").replace("\n", " ");
			scontent = escape(scontent);
			if ($('body').attr('id') == 'SpaceAlbum_Detail') {
				Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=6&imdbid=" + imgid + "&content=" + scontent + "&validcode=" + sValidCode, {random:true});
			} else {
				Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=1&imdbid=" + flvid + "&content=" + scontent + "&validcode=" + sValidCode, {random:true});
			}
			var ct = Pui.pos.elementTop(document.getElementById('Comment'));
			window.scrollTo(0, ct-30);
			$('#Comment .cl, #Comment .cc').fadeTo('slow', 0.3);
			this.blur();
			setTimeout("Pui.video.commentReplyFill()", 1000);
			$('#tb_validcode').val("");
			GetValidCodeImg();
		});
		
		
	},
	commentReplyFill: function() {
		
		var c = textarea.val().replace(/\[em(\d+)\]/g, "<img src='http://static.pomoho.com/images/em/em$1.gif' />");
		
		var u = _is_login ? '<a href="javascript:;">'+_user.nick+'</a>' : '游客';
		var s = '';
		s += '<div class="mDocument" style="_width:100%;">';
		s += '	<div class="photo"><img src="http://static.pomoho.com/static/images/photo_68.gif" alt="" /></div>';
		s += '	<div class="detail">';
		s += '		<span class="n_user">'+u+'</span>';
		s += '		<p class="text">'+c+'</p>';
		s += '	</div>';
		s += '	<div class="handle">';
		s += '		<span class="t_release">'+Pui.ui.gettime()+'</span>';
		s += '	</div>';
		s += '</div>';
		if($('#Comment h3').length == 0) {
			if (String(window.location).match(/http:\/\/home.*/)) {
				$('<p class="cc"><a href="javascript:;">查看全部</a>共<span>1</span>条评论</p>').prependTo('#span_video_review');
				$('<div class="cl">'+s+'</div>').prependTo('#span_video_review');
				$('<h3>对该视频的评论</h3>').prependTo('#span_video_review');
			} else {
				$('<p class="cc"><a href="javascript:;">查看全部</a>共<span>1</span>条评论</p>').prependTo('#Comment');
				$('<div class="cl">'+s+'</div>').prependTo('#Comment');
				$('<h3>对该视频的评论</h3>').prependTo('#Comment');
			}
		} else {
			$('#Comment .cl').prepend(s);
			$('#Comment .cl, #Comment .cc').fadeTo('slow', 1);
		}
		if (flag_comment != "undefinded" && flag_comment == 1) {
			$("#Quicktextarea").val("")
		}else{$("#post_content").val("");};
					
		//textarea.attr('value', '').focus();
	},
	collect: function() {
		if(_is_login){
			Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=2&imdbid=" + flvid);		
		}else{
			flag=2;
			Pui.newSH.loginfo();
		}
		
	},
	delblog: function(blogid) {
		if (window.confirm("确认要删除该条评论吗?")) { 	
			if ($('body').attr('id') == 'SpaceAlbum_Detail') {
				Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=4&blogid=" + blogid+"&imdbid=" + imgid);
			} else{
				Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=4&blogid=" + blogid+"&imdbid=" + flvid);
			}
		}
	},
	quote: function(bid) {
		var re_q_txt = document.getElementById("re_q_"+bid).value;
		document.getElementById("post_content").value = "[quote]"+re_q_txt+"[/quote]";
		$('#Comment textarea').focus();
	},
	clicker:function(tags){
		if(tags==1){
			if($("#HisVideo").length==0)
				Pui.video.AjaxData(flvid);
			else $("#HisVideo").show();
			
			$("#RefVideo").hide();
			$("#Col_ref .title .s2").addClass("s2_a").removeClass("s2").blur();
			$("#Col_ref .title .s1_a").addClass("s1").removeClass("s1_a");
			return
			}else{
			$("#RefVideo").show();
			$("#HisVideo").hide();
			$("#Col_ref .title .s2_a").addClass("s2").removeClass("s2_a");
			$("#Col_ref .title .s1").addClass("s1_a").removeClass("s1").blur();
			}
			
	},
	AjaxData:function() {
		var url="http://video.pomoho.com/getuservideolist.aspx?listtype=1&userid="+userid;
		Pui.loadScript(url);	
	},
	result:function(res){
	var str='<ul class="meat" id="HisVideo"">';
	if(typeof(res)=="undefined"||res.length<1){
		str+='<li style="background-image:none;text-align:center">没有相关数据</li></ul>';
		$(str).appendTo("#Col_ref");
		return	
	}
	var vLen=res.length;
	
	str += '<li class="s">';
	for (var i = 0; i < vLen; i++) {
		if (i < 2) {
			str += '<div><a title="'+res[i].title+'" target="_blank" href="http://video.pomoho.com/ent/'+res[i].id+'?'+modulestatcode+'"><img src="'+res[i].img+'" /></a><span><a title="'+res[i].title+'" target="_blank" href="http://video.pomoho.com/ent/'+res[i].id+'?'+modulestatcode+'">'+res[i].title+'</a></span><div class="playtime">'+res[i].playcost+'</div></div>';
		}
		if(i==1){str += '</li>';}
		if (i >=2) {
			str +='<li><span><a title="'+res[i].title+'" target="_blank" href="http://video.pomoho.com/ent/'+res[i].id+'?'+modulestatcode+'">'+res[i].title+'</a></span>'+res[i].playcost+'</li>';
		}	
	}
	str+='</ul>';
	//alert(str);
	$(str).appendTo("#Col_ref");	
	}
	
};

$.fn.currentVideo = function(option) {
	return this.find(option.c).each(function(){
		if($(this).find('.title a').attr('href').indexOf(flvid) != -1) {
			$(this).addClass('ac');
		}
	});
}
//add for friend,modify at 2007-9-19
function f_addfriend(userid){
	if(_is_login){
		Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=1&userid="+userid+"");
		if(typeof(_userid)!='undefined') _userid=null;
	}else{		
		flag=3;
		_userid=userid;
		Pui.newSH.loginfo();
	}	
}

//by zhuxf 2008-3-3 评论验证码  type 1 - 视频 2 - 用户  3 - 专题
var ValidCodeURL = "http://www.pomoho.com/do/video/ValidCode.aspx?type=1";

function SetValidCodeImg(){ //主函数，验证Zone写入
	var ValidCodeHtml =  '';
	//ValidCodeHtml = '请输入验证码&nbsp;&nbsp;<input id="tb_validcode" type="text" style="width:60px; border:1px #7B9EBD solid;margin:0 3px 0 0;"><a href="javascript:GetValidCodeImg();" title="看不清楚？请点击刷新验证码！" style="position:relative;top:6px;*top:4px;" ><img id="validcode" border=0  width="60" height="20" src="'+ ValidCodeURL + "&objid=" + typeid +'"></a>';
	ValidCodeHtml = '请输入验证码&nbsp;&nbsp;<input id="tb_validcode" type="text" onfocus="javascript:CodeImgLoader();" style="width:60px; border:1px #7B9EBD solid;margin:0 3px 0 0;" />';
	$('#Comment .commentAdd .form .submit input').before(ValidCodeHtml);
}
function CodeImgLoader(){
	var typeid = '';
	if(typeof(imgid)!= "undefined"){
		typeid = imgid;
	}else{
		typeid = flvid;
	}
	var s = '<a href="javascript:GetValidCodeImg();" title="看不清楚？请点击刷新验证码！" style="position:relative;top:6px;*top:4px;" ><img id="validcode" border=0  width="60" height="20" ></a>';
	$('#tb_validcode').after(s).removeAttr('onfocus');
	$('#post_content').unbind('focus');
	$('#post_content').click(function(){
		if($("#QuickComment").length>0){
		$(".f_v").hide();
		$("#QuickComment").hide();
		}
	})
	GetValidCodeImg()
}
function sameValid(){
	document.getElementById("validcode").src = document.getElementById("validImg").src;
}
function GetValidCodeImg(){ //图片点击事件 更换验证码

	if(typeof(imgid)!= "undefined"){
		if (document.getElementById("validImg")) {
			document.getElementById("validImg").src = ValidCodeURL + "&objid=" + imgid + "&ran=" + Math.random();
			if (document.getElementById("validcode")) {
				setTimeout(sameValid,200)
			}
		}
		else {
		document.getElementById("validcode").src = ValidCodeURL + "&objid=" + imgid + "&ran=" + Math.random();
		}
		
	}else{
		if(document.getElementById("validImg")){
			document.getElementById("validImg").src = ValidCodeURL + "&objid=" + flvid + "&ran=" + Math.random();
			//alert()
			if(document.getElementById("validcode"))
			setTimeout(sameValid,200)
			
		}else{
			document.getElementById("validcode").src= ValidCodeURL + "&objid=" + flvid + "&ran=" + Math.random();
		}
	}
}
function SendCallBack(v,sv){ //CallBack回调
	if(v == 0){
		alert("您的验证码错误！");
	}
	if(v == -1){
		alert("您的验证码已失效。请点击验证码图片，重新获取验证码！");
	}
	
	if(flag_comment!="undefinded"&&flag_comment==1){
		$(".f_v").show();
		$("#QuickComment").show();
		setTimeout("$('#Comment .mDocument').eq(0).remove();", 1000);
		setTimeout("textarea.attr('value', '"+sv+"');$('#QvalidText').focus();", 1000);
	}else{
		setTimeout("$('#Comment .mDocument').eq(0).remove();", 1000);
		setTimeout("textarea.attr('value', '"+sv+"');$('#tb_validcode').focus();", 1000);
	}
	
}

/***** pui.header_v2 ***************************************************/

Pui.header1 = {
	init:function(){
		this.Main();
	},
	Main: function(){
		//$('#Search .iBtn').hover(function(){//搜索按钮悬停效果
		//	$(this).css('background-position','-90px -141px');
		//},function(){
		//	$(this).css('background-position','-69px -141px');
		//});
		this.OnLoad();
		this.SelectEvents();
	},
	OnLoad: function(){
		var defalt_val = '搜一下';
		$('#SearchInput').val(defalt_val).focus(function(){//搜索框
			var val = $(this).val();
			if(val == defalt_val){
				$(this).val('');
			}
		}).blur(function(){
			var val = $(this).val();
			if(val == ''){
				$(this).val(defalt_val);
			}
		});
	},
	//模拟Select上的点击事件
	SelectEvents: function(){
		$('body').click(function(){
			if( $('#SelDiag').css('display') != 'none' ){//点击Body自动收回
				$('#SelDiag').slideUp('fast');
			}
		});
		$('.btnSel a').toggle(function(){//选择箭头上的点击事件
			$('#SelDiag').slideToggle('fast');
			this.blur();
			return false;
		},function(){
			$('#SelDiag').slideToggle('fast');
			this.blur();
			return false;
		});
		$('#SelDiag1').click(function(){//弹出Div上的点击事件，以下4项
			Pui.header1.SelectDiag('video',$(this));
			this.blur();
			return false;
		});
		$('#SelDiag2').click(function(){
			Pui.header1.SelectDiag('user',$(this));
			this.blur();
			return false;
		});
		$('#SelDiag3').click(function(){
			Pui.header1.SelectDiag('subject',$(this));
			this.blur();
			return false;
		});
	},
	//弹出Div上的点击事件过程
	SelectDiag: function(searchType,href){
		$('#SearchType').val(searchType);
		$('#SelDiag').css('display','none');
		$('#Selected').text($(href).text());
		$('#SearchT').focus();
	},
	//搜索表单提交事件过程
	DoSearch: function(o){
		var val = $(o).find('#SearchInput').val();
		if(val==''||val=='搜一下'){
			alert('对不起，关键词不能为空，请重新输入');
			$('#SearchInput').focus();			
			return false;
		}else{
			var sdi = o.searchDomain;
			var sd = "http://search.pomoho.com";
			if(sdi != undefined && sdi.value != ""){
				sd = sdi.value;
			}
			var key = encodeURIComponent(val.replace(/[\/_]/g,' '));
			var url = sd+"/"+ o.searchType.value +"search.aspx?_keyword="+key;
			window.open( url, '_blank' );
			return false;
		}
	}
};


/***** pui.header_v2 ***************************************************/

Pui.header=Pui.header_v2 = Pui.newSH = {
	init:function(){//是否登录
		_user = { uid:0, nick:'onemax', spacename:'', newmsg:0};
		_is_login = false;
		var n = Pui.cookie('LoginInfo');
		if (n) {
			var arr = n.split('$***$');
			_user = { uid:arr[0].replace('LoginInfo=', ''), nick:arr[1], spacename:arr[2], newmsg:0,spaceurl:arr[3] };
			_is_login = true;
			this.islogin();
		}else{
			this.unlogin();
		};
		this.doSearch();
		Pui.header1.init();
	},
	unlogin:function(){
		var str='';
		str+='<li class="s"><a target="_blank" class="f" title="返回首页" href="http://www.pomoho.com/">返回首页</a></li>';
		str+='<li class="s"><a class="f" title="登录" href="javascript:Pui.header.loginfo()">登录</a></li>';
		str+='<li class="s logout"><a class="f" title="注册" href="http://www.pomoho.com/ui/login.aspx" target="_blank">注册</a></li>';
		$("#TopNav").html(str);
		
	},
	islogin:function(){
		var t_time=this.localTime();
		var str='';
		str+= '<ul id="TopNav">';
		str+= '<li class="s" >'+t_time+'，<a class="user" target="_blank" href="http://home.pomoho.com/'+_user.spaceurl+'.shtml" title="'+_user.nick+'" >'+Pui.header.SetString(_user.nick,10)+'</a></li>';
		str+= '<li class="s"><a class="count" title="你的帐户" href="http://www.pomoho.com/manage/index.aspx" target="_blank" >帐户</a>';
		str+= '   <div class="d s3">';
		str+= '     <ul>';
		str+= '       <li><a class="d_item" title="我的视频" href="http://www.pomoho.com/manage/managevideo.aspx" target="_blank" >我的视频</a></li>';
		str+= '       <li><a class="d_item" title="我的订阅" href="http://www.pomoho.com/manage/subscribevblog.aspx" target="_blank" >我的订阅</a></li>';
		str+= '       <li><a class="d_item" title="我的收藏" href="http://www.pomoho.com/manage/managevideo.aspx?type=favs" target="_blank" >我的收藏</a></li>';
		str+= '       <li><a class="d_item" title="我的相册" href="http://www.pomoho.com/manage/managealbum.aspx" target="_blank" >我的相册</a></li>';
		str+= '     </ul>';
		str+= '     <div class="m1"><a title="更多管理" href="http://www.pomoho.com/manage/index.aspx" target="_blank" >更多..&nbsp;&nbsp;</a></div>';
		str+= '   </div>';
		str+= ' </li>';
		str+= ' <li class="s"><a class="msg" title="你的消息" href="http://www.pomoho.com/manage/messagelist.aspx?type=1" target="_blank" >消息</a><span>(0)</span>';
		str+= '   <div class="d s2">';
		str+= '     <div class="title"><div class="d_video">主题</div><div class="d_author">消息来源</div></div>';
		str+= '     <ul>';
		str+= '     </ul>';
		str+= '     <div class="m"><a title="全部消息" href="http://www.pomoho.com/manage/messagelist.aspx?type=1" target="_blank" >全部消息&gt;&gt;</a></div>';
		str+= '   </div>';
		str+= ' </li>';
		str+= ' <li class="logout"><a title="退出登录" href="http://www.pomoho.com/ui/logout.aspx?AfterLoginReturnURL='+window.location+'" >退出</a></li>';
		str+= ' </ul>';
		$("#L").removeClass().html(str);
		this.SH();
		Pui.loadScript("http://notice.pomoho.com/loadmessage2.0.aspx");
	},
	SH:function(){
		var tim;	
    	$("#TopNav .s").hover(function(){
			$(this).siblings().find(".d").hide();
    		$(this).find(".d").show();
    		clearTimeout(tim);
		},function(){
    		tim=setTimeout(overDiv,500);
    		function overDiv(){
    		$("#TopNav").find(".d").slideUp();
		}
		});
    },
    localTime:function(){
		var time = new Date();
		var hour = time.getHours();
		var t_time = ($.browser.msie) ? String(time).split(" ")[3].substr(0,5) : String(time).split(" ")[4].substr(0,5);
		switch (hour){
			case 0:	case 1:	case 2:	case 3:	case 4:	case 5:	case 6:	case 7:
				t_time='早上好';
				break;
			case 8:	case 9:	case 10:case 11:
				t_time='上午好';
				break;
			case 12:
				t_time='中午好';
				break;
			case 13:case 14:case 15:case 16:case 17:
				t_time='下午好';
				break;
			case 18:case 19:case 20:case 21:case 22:case 23:
				t_time='晚上好';
				break;
		}
		return  t_time;
      },
      Msginit:function(jsonMsg){
	     	//var jsonMsg=[6,{msgtitle:"标题",msgtype:1,msgid:454},{msgtitle:"标题",msgtype:2,msgid:454},{msgtitle:"标题",msgtype:3,msgid:454},{msgtitle:"标题",msgtype:2,msgid:454},{msgtitle:"标题",msgtype:1,msgid:454}];
	        var str='';
	        var len=jsonMsg.length;
	        if(len<=1) 
	        {
	        	var str='<li style="width:100%">您还没有消息</li>';
	        }else{
		        for(var i=1;i<=len-1;i++)
		        {
		        	var msgtypename;
			        	switch(jsonMsg[i].msgtype)
			        {
			        	case 1:
							msgtypename="站内消息"
							break;
						case 2:
							msgtypename="系统消息"
							break
						case 3:
							msgtypename="公告"
							break
					}
			        str+= '<li id="msg'+i+'">';
					if(jsonMsg[i].msgtype!=3){
				    str+= '<div class="d_video"><a title="'+jsonMsg[i].msgtitle+'" href="http://www.pomoho.com/manage/readmessage.aspx?receiveid='+jsonMsg[i].msgid+'&rettype=1" target="_blank" >'+jsonMsg[i].msgtitle+'</a></div>';
					}else{
				    str+= '<div class="d_video"><a title="'+jsonMsg[i].msgtitle+'" href="http://www.pomoho.com/manage/readmessage.aspx?bulletinid='+jsonMsg[i].msgid+'&rettype=1" target="_blank" >'+jsonMsg[i].msgtitle+'</a></div>';
					}

				    str+= '<div class="d_author">'+msgtypename+'</div>';
				    str+= '<a class="d_close" title="删除消息" href="javascript:Pui.header.Msgdel('+jsonMsg[i].msgid+','+jsonMsg[i].msgtype+','+i+')" ></a> </li>';
			     }
			}     
	         $("#TopNav .s2 ul").html(str);
	        $("#TopNav .s2").parent().find("span").html("("+jsonMsg[0]+")");      
    },
    Msgdel:function(msgid,msgtype,num){
			$("#msg"+num).remove();												        	      		
  		    var Msgurl="http://notice.pomoho.com/readmessage.aspx?messageID="+msgid+"&Userid="+_user.uid+"&messageType="+msgtype;
  		    Pui.loadScript(Msgurl);
  		     var num=parseInt($("#TopNav .s2").parent().find("span").html().substr(1))-1;
  		     if (num<=0) num=0;
  		     $("#TopNav .s2").parent().find("span").html("("+num+")"); 
    },
    doSearch:function(e){
			if (typeof(s)!='undefined') return
				else s=1;
    		$("#goSearch").click(function(){
				var values=$.trim($("#searchGame").val());
					if(!values) {
						alert("关键字不能为空");
						$("#searchGame").focus();
					}else{
						var param=encodeURIComponent(values.replace(/[\/_]/g,' '));
						var url="http://search.pomoho.com/videosearch.aspx?_keyword="+param;
						window.open( url, '_blank' ); 
					}
			});
    },
    /******add for login*******************/
    logDiv:function(sType,sTarget,sUrl){
		var str='';
		if($.browser.msie && String($('body').attr('id')) == 'B-Upload'){
			str+='';
		}else{
			if($.browser.msie){
				str+='<iframe id="zhezhao"></iframe>';
			}else{
				str+='<div id="zhezhao"></div>';
			}
		}
		str+='	<div id="Prompt" class="prompt">';
		str+='		  <div class="k log_v">';
		str+='		    <div class="meat">';
		str+='		      <div class="close"><img alt="关闭" src="http://static01.pomoho.com/themes/site/default/images/games/close.gif" width="16" height="16" /></div>';
		str+='		      <h3></h3>';
		str+='		      <p class="p2">您的帐号：';
		str+='		        <input id="uidName" type="text" onkeyup="Pui.header.submitF(event)" />';
		str+='		      </p>';
		str+='		      <p class="p2">登录密码：';
		str+='		        <input id="uidPwd" type="password" onkeyup="Pui.header.submitF(event)" />';
		str+='		        <a href="http://www.pomoho.com/ui/findpassword.aspx" target="_blank">忘记密码</a></p>';
		str+='		      <p class="pbt">';
		str+='		        <input id="btnlog" class="log" type="submit" value="登录" />';
		str+='		        <input id="reg" class="log" type="button" value="注册" />';
		str+='		      </p>';
		str+='		    </div>';
		str+='		  </div>';
		str+='		</div>';
		$("body").prepend(str);
		
        if($.browser.msie && String($('body').attr('id')) == 'B-Upload'){
        	Pra.ui.overlay();
      	 }else{
      	 	if($.browser.msie){
				var cw = window.frames['zhezhao'];
				cw.document.open();  
				cw.document.write('<style type="text/css">body{background:#000;}</style>');   
				cw.document.close();
			}
		}

		$("#Prompt .close img").bind("click",Pui.header.closeDiv);
		$("#btnlog").click(function(){
			Pui.header.login(sType,sTarget,sUrl);
		});
		$("#reg").click(function(){
			window.open('http://www.pomoho.com/ui/login.aspx');
		});	
	},
	showLogDiv:function(sType,sTarget,sUrl){
			if(String($('body').attr('id')) == 'B-Upload'){
				Pui.header.logDiv(sType,sTarget,sUrl);
			}else if(!$("#Prompt").length){
				Pui.header.logDiv(sType,sTarget,sUrl);
			}
			var doc=document;
			var docElement=doc.documentElement;
			var sHeight=docElement.clientHeight;
			var dH=docElement.scrollHeight>sHeight?docElement.scrollHeight:sHeight;
			var scH=docElement.scrollTop>=0?(docElement.scrollTop+sHeight/2):sHeight;
			var h=scH-$("#Prompt").height()/2;
			var w=docElement.clientWidth/2-$("#Prompt").width()/2;
			$("#zhezhao").height(dH).show();
			$("#Prompt").css({top:h,left:w});
	},
	loginfo:function(sType,sTarget,sUrl){
			Pui.header.showLogDiv(sType,sTarget,sUrl);
			$("#Prompt").show();
			$("#Prompt .k")[0].className="k log_v";
			$('#uidName').focus();//2008-9-11 21:59:45 By SMbey0nd	
			if(document.attachEvent){
				document.attachEvent('onkeyup',Pui.header.EXC);
			}else{
				document.addEventListener('keyup',Pui.header.EXC,false)
			}															
	},
	submitF:function(e){
		var event = window.event || e;
		if(event.keyCode==13)
			$("#btnlog").click();
	},
	EXC:function(e){
		var event = window.event || e;
		if(event.keyCode==27)
			Pui.header.closeDiv();
	},
	login:function(sType,sTarget,sUrl){
			var userName=$.trim($("#uidName").val());
				var pwd=$("#uidPwd").val();
				
				if(userName==''||pwd==''){
					alert("用户名或者密码不能为空");
				}else{
					if(sType||sUrl){
						Pui.ui.logDiagAjax(userName,pwd,sType,sTarget,sUrl);
					}else{
						Pui.header.logAjax(userName,pwd);
					}
				}

	},
	closeDiv:function(){
			if($.browser.msie && String($('body').attr('id')) == 'B-Upload'){
	        	Pra.ui.overlay();
	        }else if(String($('body').attr('id')) == 'B-Upload'){
				$("#zhezhao").remove();
			}else{
				$("#zhezhao").hide();
			}
			$("#Prompt").hide();
	},
	logAjax:function(userName,pwd){
			var urlRoot = window.location.hostname;
			var urlString=window.location.toString ().toLowerCase();
			var urlstr;
			if(urlString.indexOf("video.pomoho.com/")==-1){
				urlstr="/do/interfaces/sendajaxreq.aspx";
			}else{
				urlstr="/sendajaxreq.aspx";
			}

			$.ajax({
		    url:"http://" + urlRoot + urlstr,//根目录放置sendajaxreq.aspx
		    //url:"http://www.pomoho.com/do/interfaces/sendajaxreq.aspx",
		    dataType: "xmlDocument",
		    type:"post",
		    data: "action=http://www.pomoho.com/ui/logindo.aspx&form_name="+userName+"&form_password="+pwd+"&type=gamelogin&random="+Math.random(),
		    error: function(){ alert('可能网络问题,登录失败,请重试!');Pui.header.closeDiv(); },
		    success: function(result){
		    	var userlog=eval(result);
		   		 //1表示登录成功,-1表示登录帐号不存在,-2表示用户名或者密码错误,-3表示用户名或者密码为空
				switch (parseInt(userlog[0].stat)){
				case -1:
					alert("登录帐号不存在");
					break;
				case -2:
					alert("用户名或者密码错误,请重试");
					break;	
				case 1:
					Pui.header.cookie('UserInfo',userlog[1].UserInfo,{path:'/',domain:'.pomoho.com',expires: 1/6 });	
					Pui.header.cookie('LoginInfo',userlog[2].LoginInfo,{path:'/',domain:'.pomoho.com',expires: 1/6 });
					var urlString = window.location.toString().toLowerCase();
					if(urlString.indexOf("pomoho.com/combo")!=-1&&(typeof(flag)=='undefined'||flag==null))
					{
						window.location.reload();
						return
					}
					Pui.header.init();
					if( String($('body').attr('id')) == 'B-Upload' && document.getElementById("hid_n").value=="true" && (typeof(flag)=='undefined'||flag==null) )
					{
						document.getElementById("FrameUpload").contentWindow.Pui.upload.unite('GoTo2');
						document.getElementById("FrameUpload").contentWindow.start_upload(
							document.getElementById("FrameUpload").contentWindow.$('#file1').val(),
							document.getElementById("FrameUpload").contentWindow.$('#uploadForm_Title').val()
						);
						if(document.getElementById("FrameUpload").contentWindow.$('#hid_ver').val() == 'family'){
							document.getElementById("FrameUpload").contentWindow.$('#Upload_2 .s4').addClass('none');
							document.getElementById("FrameUpload").contentWindow.$('#Upload_2 .s5').addClass('none');
							$('#Layout_1').height('650px');
						}else{
							$('#Layout_1').height('700px');
						}
					}
					if(typeof(flag)=='undefined'||flag==null)
						Pui.header.closeDiv();	//flag=1:转发给好友,flag=2:收藏,flag=3:加为好友,flag=4:加入社团
					else if(flag==1)
						{
							Pui.user.haveFriend();
							flag=null;
						}
					else if(flag==2)
						{
							Pui.loadScript("http://www.pomoho.com/do/video/dealajaxdata.aspx?itype=2&imdbid=" + flvid);
							flag=null;
							Pui.header.closeDiv();
						}
					else if(flag==3)
						{
							f_addfriend(_userid);
							flag=null;
							Pui.header.closeDiv();
						}
					else if(flag==4)
						{
							flag=null;
							Pui.header.closeDiv();
							f_comboInterFace(addPram.otype,addPram.atype,addPram.comboid,_user.uid);
							Pui.header.closeDiv();
						}
					else if(flag==5)
						{
							flag=null;
							Pui.ReUrl(pathUrl);
							Pui.newSH.closeDiv();
						}		
					
					break;
				default:
					alert("系统错误,请重试，错误代码："+userlog[1].ErrMsg);
					Pui.header.closeDiv();
				}	
		 	}
		});	
	},
	
	cookie: function(name, value, options) {
		if (typeof(value) != 'undefined') {
			options = options || {};
			if (value === null) {
				value = '';
				options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
				var date;
				if (typeof options.expires == 'number') {
					date = new Date();
					date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
				} else {
					date = options.expires;
				}
				expires = '; expires=' + date.toUTCString();
			}
			var path = options.path ? '; path=' + options.path : '';
			var domain = options.domain ? '; domain=' + options.domain : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', name+'='+value, expires, path, domain, secure].join('');
			} else {
				var cookieValue = null;
				if (document.cookie && document.cookie != '') {
					var cookies = document.cookie.split(';');
					for (var i = 0; i < cookies.length; i++) {
						var cookie = jQuery.trim(cookies[i]);
						if (cookie.substring(0, name.length + 1) == (name + '=')) {
							cookieValue = unescape(cookie.substring(name.length + 1));
							break;
						}
					}
				}
				return cookieValue;
			}
		},
		SetString:function (str,len)
		{
			var strlen = 0;
			var s = "";
			for(var i = 0;i < str.length;i++)
			{
			        if(str.charCodeAt(i) > 128)
			         strlen += 2;
			        else
			        strlen++;
			        s += str.charAt(i);
			        if(strlen >= len)
			        return s;
			}
			return s;
		}
	};


Pui.game={        
		showPromptDiv: function(flvid, flvtitle){
			Pui.user.showPromptDiv(flvid, flvtitle);
		}
}
Pui.msg  = {readMessageHandler:function(a){}};


//zh_flash  by@2009 2-25 zhuxuefeng
//zh_flash
document.write('<div id="ad_div"></div>');

function f_ad_zuhechaungyi(divname,adurl, w, h, _x, _y,_t) {
		var str = '';
		str += '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="ad_flash">';
		str += '<param name="wmode" value="transparent" >';
		str += '<param name="movie" value="'+ adurl +'">';
		str += '<param name="quality" value="autohigh">';
		str += '<embed width="'+ w +'" height="'+ h +'" src="'+ adurl +'" quality="autohigh" wmode="transparent" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="ad_flash"></embed>';
		str += '</object>';

		document.getElementById(divname).style.zIndex=100;
		document.getElementById(divname).style.display = "block";
	 	document.getElementById(divname).style.position = "absolute";
		var doc=document;
		var docElement=doc.documentElement;
		var _left=docElement.clientWidth/2-w/2;
		document.getElementById(divname).style.left=_left+"px";

		document.getElementById(divname).style.top=_y+"px";
		document.getElementById(divname).style.width=w+"px";
		document.getElementById(divname).style.height=h+"px";
		document.getElementById(divname).innerHTML = str;
		setTimeout("zuheEnd()", _t*1000)
}
function zuheEnd() { 
			document.getElementById("ad_div").innerHTML="";
			document.getElementById("ad_div").style.display="none";
}

//公告滚动 ransiwei 2009427
var int;
function AutoScroll(obj){
        $(obj).find("ul#publicNewsList").animate({
                marginTop:"-42px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}
function upScroll(){
 int=setInterval('AutoScroll("#publicNews")',3000);
}
function stopScroll(){
clearInterval(int)
}
$(function(){
upScroll();
$("ul#publicNewsList li a").hover(function(){stopScroll()},function(){upScroll()})
});
function closeFLoatMedia(){$('#ShowED_SHOW div:first').click(function(){$('#ShowED_SHOW').hide();});}
function verticalAD120(){if($('#B-06>iframe')){
	$('#B-06>iframe').css("marginTop",(140-$('#B-06>iframe').height())/2);}
	else if($('#B-06>img')){
	$('#B-06>img').css("marginTop",(140-$('#B-06>img').height())/2);}
	else if($('#B-06>object')){
	$('#B-06>object').css("marginTop",(140-$('#B-06>object').height())/2);}}

	